<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>收派标准</title>
    <meta charset="UTF-8">
    <title>取派标准</title>
    <!-- 导入jquery核心类库 -->
    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <!-- 导入easyui类库 -->
    <link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
    <link rel="stylesheet" type="text/css" href="../../css/default.css">
    <script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
    <script type="text/javascript" src="../../js/easyui/ext/jquery.cookie.js"></script>
    <script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>

    <script>
        $(function () {

            $('#grid').datagrid({
                iconCls : 'icon-forward',
                fit : true,
                border : false,
                rownumbers : true,
                striped : true,
                pageList: [2,30,50,100],
                pagination : true,
                toolbar : toolbar,
//                url : "../../standard_pageQuery",
                url : "../../standard_queryByPage.action",
//                url:"../../data/standard.json",
                idField : 'id',
                columns : columns
            });

            //点击保存按钮，提交表单
            $('#save').click(function () {

                if ($('#standardForm').form('validate')) {
                    $('#standardForm').submit();
                }else {
                    $.messager.alert("警告","表单中有一些非法的内容","warning");
                }

            });


        });

        var toolbar=[{
            id : 'button-add',
            text : '增加',
            iconCls : 'icon-add',
            handler:function () {
//                $.messager.alert("warning","button-add");
                $('#addWin').window('open');
            }
        },{
            d : 'button-edit',
            text : '修改',
            iconCls : 'icon-edit',
            handler:function () {
                var rows = $('#grid').datagrid('getSelections');
                if(rows.length!=1){
                    $.messager.alert("警告","只能选择一行修改","warning");
                }else{
                    var row = rows[0];
                    $('#standardForm').form('load',row);
                    $('#addWin').window('open');
                }
            }
        }];

        // 定义列
        var columns = [ [ {
            field : 'id',
            checkbox : true
        },{
            field : 'name',
            title : '标准名称',
            width : 120,
            align : 'center'
        }, {
            field : 'minWeight',
            title : '最小重量',
            width : 120,
            align : 'center'
        }, {
            field : 'maxWeight',
            title : '最大重量',
            width : 120,
            align : 'center'
        }, {
            field : 'minLength',
            title : '最小长度',
            width : 120,
            align : 'center'
        }, {
            field : 'maxLength',
            title : '最大长度',
            width : 120,
            align : 'center'
        }, {
            field : 'operator',
            title : '操作人',
            width : 120,
            align : 'center'
        }, {
            field : 'operatingTime',
            title : '操作时间',
            width : 120,
            align : 'center'
        }, {
            field : 'company',
            title : '操作单位',
            width : 120,
            align : 'center'
        } ] ];

    </script>
</head>


<body class="easyui-layout">

    <div region="center" border="false">
        <table id="grid"></table>
    </div>

    <div id="addWin" class="easyui-window" title="My Window" style="width:600px;top:50px;left:200px" data-options="iconCls:'icon-save',closed:true,modal:true,collapsible:false,minimizable:false,maximizable:false">
        <div region="north" style="height:31px;overflow:hidden;" split="false" border="false">
            <div class="datagrid-toolbar">
                <a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true">保存</a>
            </div>
        </div>

        <div region="center" style="overflow:auto;padding:5px;" border="false">
            <form id="standardForm" action="../../standard_save.action" method="post">
                <table class="table-edit" width="80%" align="center">
                    <tr class="title">
                        <td colspan="2">收派标准信息
                            <!--提供隐藏域 装载id -->
                            <input type="hidden" name="id" />
                        </td>
                    </tr>
                    <tr>
                        <td>收派标准名称</td>
                        <td>
                            <input type="text" name="name"
                                   class="easyui-validatebox" data-options="required:true" />
                        </td>
                    </tr>
                    <tr>
                        <td>最小重量</td>
                        <td>
                            <input type="text" name="minWeight"
                                   class="easyui-numberbox" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>最大重量</td>
                        <td>
                            <input type="text" name="maxWeight" class="easyui-numberbox" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>最小长度</td>
                        <td>
                            <input type="text" name="minLength" class="easyui-numberbox" required="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>最大长度</td>
                        <td>
                            <input type="text" name="maxLength" class="easyui-numberbox" required="true" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>

    </div>

</body>

</html>